#include "gtkcssprovider.h"
#include "gtkstylecontextprivate.h"
+#include "gtkarrayimplprivate.h"
#include <errno.h>
#if defined(_MSC_VER) && _MSC_VER >= 1500
GHashTableIter iter;
guint max_count;
gpointer key, value;
- GPtrArray *exact_matches;
+ void *exact_matches_stack[8];
+ GtkArray exact_matches_array;
gint32 res;
guint i;
matched_infos = g_alloca (sizeof (GtkCssSelectorRuleSetInfo *) * n_infos);
remaining_infos = g_alloca (sizeof (GtkCssSelectorRuleSetInfo *) * n_infos);
- exact_matches = NULL;
+ gtk_array_init (&exact_matches_array, (void**)exact_matches_stack, 8);
for (i = 0; i < n_infos; i++)
{
GtkCssSelectorRuleSetInfo *info = infos[i];
if (info->current_selector == NULL)
{
/* Matches current node */
- if (exact_matches == NULL)
- exact_matches = g_ptr_array_new ();
- g_ptr_array_add (exact_matches, info->match);
+ gtk_array_add (&exact_matches_array, info->match);
if (info->selector_match != NULL)
*info->selector_match = GUINT_TO_POINTER (tree_offset);
}
}
}
- if (exact_matches)
+ if (exact_matches_array.len > 0)
{
- g_ptr_array_add (exact_matches, NULL); /* Null terminate */
+ gtk_array_add (&exact_matches_array, NULL); /* Null terminate */
res = array->len;
- g_byte_array_append (array, (guint8 *)exact_matches->pdata,
- exact_matches->len * sizeof (gpointer));
- g_ptr_array_free (exact_matches, TRUE);
+ g_byte_array_append (array, (guint8 *)gtk_array_get_data (&exact_matches_array),
+ exact_matches_array.len * sizeof (gpointer));
+
+ gtk_array_free (&exact_matches_array, NULL);
}
else
res = GTK_CSS_SELECTOR_TREE_EMPTY_OFFSET;